#!/usr/bin/env bash
# 获取git当前分支：是本地分支名
git_branch()
{
    branch=''
    if [ -d '.git' ]; then
        branch=`git describe --contains --all HEAD|tr -s '\n'`
    fi
    # 这样也可以判空
    if [ ! ${branch} ];then   echo "获取branch 失败"
    else  echo ${branch}
    fi

}
git_branch
#echo git branch -v|grep \*|awk '{print $2}'

# windows msysgit
IPADDRS="eth0=`ipconfig |grep -i 'IPv4' |awk -F ': +' '{print $2}' |awk 'BEGIN{ORS=" "}{print $0}'`"
echo ${IPADDRS}
export PS1="\n\033[1;34m[\u@\H]\e[m \033[1;33m $IPADDRS \e[m \n[\t] PWD => \033[1;35m\w\e[m \033[0;33m\$(git_branch)\e[m \n\#># "
